 $(function(){
  if (!placeholderSupport()) { // 判断浏览器是否支持 placeholder
      $('[placeholder]').focus(function() {
        if($('#indexFlag').size()>0){
          if($("#start").val() != $("#start").attr("placeholder")){
            $("#start").css({"color":"#444"});
          }
        }
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
          input.val('');
          input.removeClass('placeholder');
        }else{
          input.css({"color":"#444"});
        }
      }).blur(function() {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
          input.addClass('placeholder');
          input.val(input.attr('placeholder'));
          input.css({"color":"#bbb"})
        }else{
          input.css({"color":"#444"});
        }
      }).blur();
    };
    
  setImg();

 })
 function placeholderSupport() {
  return 'placeholder' in document.createElement('input');
}
function setImg(){
    // var staticUrl = $('#staticUrl').val();
    var sacle=2/3;
    var height = $('.setImg:eq(0)').parent('.img_box').width()*sacle;
    $('.setImg').each(function(){
        var _this = $(this);
        var newImg = new Image();
        newImg.onload = function(){
            var imgH = _this.height();
            if(imgH<height){
                _this.css({'margin-top':(height-imgH)/2+'px'});
            }
        }
        newImg.src = _this.attr('src');

        newImg.onerror = function(){
          // 默认图片
            // _this.attr('src',staticUrl+'/images/base1.jpg');
        }
       
        $(this).parent('.img_box').css({'height':height,'overflow':'hidden'});

       

    });

}